package generator.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;

/**
 * 商品分类属性表
 * @TableName product_attribute
 */
@TableName(value ="product_attribute")
@Data
public class ProductAttribute implements Serializable {
    /**
     * 主键
     */
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 
     */
    private Long spuId;

    /**
     * 分类属性id
     */
    private Long attributeId;

    /**
     * 属性名称
     */
    private String attributeName;

    /**
     * 属性名称
     */
    private String attributeValue;

    /**
     * 值类型：MULTIPLE-多选，SINGLE-单选，TEXT-文本，NUMBER-数字, RANGE-区间
     */
    private Object attributeValueType;

    /**
     * 属性单位
     */
    private String attributeValueUnit;

    /**
     * 是否主属性
     */
    private Integer search;

    /**
     * 排序
     */
    private Integer sort;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 更新时间
     */
    private Date updateTime;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        ProductAttribute other = (ProductAttribute) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getSpuId() == null ? other.getSpuId() == null : this.getSpuId().equals(other.getSpuId()))
            && (this.getAttributeId() == null ? other.getAttributeId() == null : this.getAttributeId().equals(other.getAttributeId()))
            && (this.getAttributeName() == null ? other.getAttributeName() == null : this.getAttributeName().equals(other.getAttributeName()))
            && (this.getAttributeValue() == null ? other.getAttributeValue() == null : this.getAttributeValue().equals(other.getAttributeValue()))
            && (this.getAttributeValueType() == null ? other.getAttributeValueType() == null : this.getAttributeValueType().equals(other.getAttributeValueType()))
            && (this.getAttributeValueUnit() == null ? other.getAttributeValueUnit() == null : this.getAttributeValueUnit().equals(other.getAttributeValueUnit()))
            && (this.getSearch() == null ? other.getSearch() == null : this.getSearch().equals(other.getSearch()))
            && (this.getSort() == null ? other.getSort() == null : this.getSort().equals(other.getSort()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
            && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getSpuId() == null) ? 0 : getSpuId().hashCode());
        result = prime * result + ((getAttributeId() == null) ? 0 : getAttributeId().hashCode());
        result = prime * result + ((getAttributeName() == null) ? 0 : getAttributeName().hashCode());
        result = prime * result + ((getAttributeValue() == null) ? 0 : getAttributeValue().hashCode());
        result = prime * result + ((getAttributeValueType() == null) ? 0 : getAttributeValueType().hashCode());
        result = prime * result + ((getAttributeValueUnit() == null) ? 0 : getAttributeValueUnit().hashCode());
        result = prime * result + ((getSearch() == null) ? 0 : getSearch().hashCode());
        result = prime * result + ((getSort() == null) ? 0 : getSort().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", spuId=").append(spuId);
        sb.append(", attributeId=").append(attributeId);
        sb.append(", attributeName=").append(attributeName);
        sb.append(", attributeValue=").append(attributeValue);
        sb.append(", attributeValueType=").append(attributeValueType);
        sb.append(", attributeValueUnit=").append(attributeValueUnit);
        sb.append(", search=").append(search);
        sb.append(", sort=").append(sort);
        sb.append(", createTime=").append(createTime);
        sb.append(", updateTime=").append(updateTime);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}